﻿{template 'web/_header'}
{template 'web/order/tabs'}
<style type="text/css">
    .main .form-horizontal .form-group{margin-bottom:0;}
    .main .form-horizontal .modal .form-group{margin-bottom:15px;}
    #modal-confirmsend .control-label{margin-top:0;}
</style>
<div class="main">
    <form class="form-horizontal form" action="" method="post" enctype="multipart/form-data" onsubmit="return formcheck(this)">
        {if $item['transid']}<div  class="alert alert-error"><i class="fa fa-lightbulb"></i> 此为微信支付订单，必须要提交发货状态！</div>{/if}
        <input type="hidden" name="dispatchid" value="{$dispatch['id']}" />
        <div class="panel panel-default">
            <div class="panel-heading">
                订单信息
            </div>
            <div class="panel-body">
            <div class="form-group">
                <label class="col-xs-12 col-sm-3 col-md-2 control-label">粉丝</label>
                <div class="col-sm-9 col-xs-12">
                    <img src='{$member['avatar']}' style='width:100px;height:100px;padding:1px;border:1px solid #ccc' />
                         {$member['nickname']}
                </div>
            </div>
            <div class="form-group">
                <label class="col-xs-12 col-sm-3 col-md-2 control-label">会员信息</label>
                <div class="col-sm-9 col-xs-12">
                    <div class='form-control-static'>姓名: {$member['realname']} / 手机号: {$member['mobile']} /微信号: {$member['weixin']}</div>
                </div>
            </div>
                
                {if $item['transid']}
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">微信交易号 :</label>
                    <div class="col-sm-9 col-xs-12">
                        <p class="form-control-static">{$item['transid']}</p>
                    </div>
                </div>
                {/if}
                      <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">订单编号 :</label>
                    <div class="col-sm-9 col-xs-12">
                        <p class="form-control-static">{$item['ordersn']} </p>
                    </div>
                </div>
                
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">订单金额 :</label>
                    <div class="col-sm-9 col-xs-12">
                        <p class="form-control-static">{$item['price']} 元 （商品: {$item['goodsprice']} 元 运费: {$item['dispatchprice']} 元 
                            会员折扣: -{$item['discountprice']}元 积分抵扣:-{$item['deductprice']}元 余额抵扣:-{$item['deductcredit2']}元
                            满额立减: -{$item['deductenough']}元 优惠券: -{$item['youhuiquan']}元
                            )</p>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">配送方式 :</label>
                    <div class="col-sm-9 col-xs-12">
                        <p class="form-control-static">{if empty($item['addressid'])}
                            {if $item['isverify']==1}线下核销{else}自提{/if}
                            {else}{if empty($dispatch)}
                             快递
                            {else}
                            {$dispatch['dispatchname']}
                            {/if}
                            {/if}</p>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">付款方式 :</label>
                    <div class="col-sm-9 col-xs-12">
                        <p class="form-control-static">
                            {if $item['paytype'] == 0}未支付{/if}
                            {if $item['paytype'] == 1}余额支付{/if}
                            {if $item['paytype'] == 11}后台付款{/if}
                            {if $item['paytype'] == 21}微信支付{/if}
                            {if $item['paytype'] == 22}支付宝支付{/if}
                            {if $item['paytype'] == 23}银联支付{/if}
                            {if $item['paytype'] == 3}货到付款{/if}

                        </p>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">订单状态 :</label>
                    <div class="col-sm-9 col-xs-12">
                        <p class="form-control-static">
                            {if $item['status'] == 0}<span class="label label-info">待付款</span>{/if}
                            {if $item['status'] == 1}<span class="label label-info">待发货</span>{/if}
                            {if $item['status'] == 2}<span class="label label-info">待收货</span>{/if}
                            {if $item['status'] == 3}<span class="label label-success">已完成</span>{/if}
                            {if $item['status'] == -1}
                              {if !empty($refund) && $refund['status']==1}
                                <span class="label label-default">已退款</span>
                                {else}
                              <span class="label label-default">已关闭</span>
                              {/if}
                            {/if}
                        </p>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">下单日期 :</label>
                    <div class="col-sm-9 col-xs-12">
                        <p class="form-control-static">{php echo date('Y-m-d H:i:s', $item['createtime'])}</p>
                    </div>
                </div>
                {if $item['status']>=1}
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">付款时间 :</label>
                    <div class="col-sm-9 col-xs-12">
                        <p class="form-control-static">{php echo date('Y-m-d H:i:s', $item['paytime'])}</p>
                    </div>
                </div>
                {/if}
                
                {if $item['status']>=2 && $item['isverify']!=1 }
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">发货信息 :</label>
                    <div class="col-sm-9 col-xs-12">
                        <p class="form-control-static">快递公司: {$item['expresscom']}  <br/>快递单号: {$item['expresssn']} <br/>发货时间: {php echo date('Y-m-d H:i:s', $item['sendtime'])}</p>
                    </div>
                </div>
                {/if}
                
                {if $item['status']>=3}
                {if $item['isverify']==1}
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">核销信息 :</label>
                    <div class="col-sm-9 col-xs-12">
                        <p class="form-control-static">
                            消费码: {$item['verifycode']}<br/>
                            核销时间: {php echo date('Y-m-d H:i:s', $item['finishtime'])}<br/>
                        核销人:  {if empty($item['verifyopenid'])}后台核销{else} {php $s = m('member')->getMember($item['verifyopenid'])}{$s['nickname']}{/if}
                        </p>
                    </div>
                </div>
                {else}
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">完成时间 :</label>
                    <div class="col-sm-9 col-xs-12">
                        <p class="form-control-static">{php echo date('Y-m-d H:i:s', $item['finishtime'])}</p>
                    </div>
                </div>
                {/if}
                
                {/if}
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">备注 :</label>
                    <div class="col-sm-9 col-xs-12"><textarea style="height:150px;" class="form-control" name="remark" cols="70">{$item['remark']}</textarea></div>
                </div>
            </div>
        </div>
        {if $com_set['level']>0 && count($agents)>0}
        <div class="panel panel-default">
            <div class="panel-heading">
                分销员信息
            </div>
            <div class="panel-body">
                {if !empty($agents[0])}
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">分销员 :</label>
                    <div class="col-sm-9 col-xs-12">
                        <p class="form-control-static">{$agents[0]['nickname']} ({$agents[0]['realname']}/{$agents[0]['mobile']})</p>
                    </div>
                </div>
                {/if}
                {if !empty($agents[1])}
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">二级分销员 :</label>
                    <div class="col-sm-9 col-xs-12">
                        <p class="form-control-static">{$agents[1]['nickname']} ({$agents[1]['realname']}/{$agents[1]['mobile']})</p>
                    </div>
                </div>
                {/if}
                {if !empty($agents[2])}
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">一级分销员 :</label>
                    <div class="col-sm-9 col-xs-12">
                        <p class="form-control-static">{$agents[2]['nickname']} ({$agents[2]['realname']}/{$agents[2]['mobile']})</p>
                    </div>
                </div>
                {/if}
            </div>
        </div>
        {/if}
        {if !empty($item['addressid'])}
          <div class="panel panel-default">
            <div class="panel-heading">
              收件人1信息
            </div>
            <div class="panel-body">
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">姓名 :</label>
                    <div class="col-sm-9 col-xs-12">
                        <p class="form-control-static">{$user['realname']}</p>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">手机 :</label>
                    <div class="col-sm-9 col-xs-12">
                        <p class="form-control-static">{$user['mobile']}</p>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">地址 :</label>
                    <div class="col-sm-9 col-xs-12">
                        <p class="form-control-static">{$user['address']}</p>
                    </div>
                </div>
            </div>
        </div>
        {elseif $item['isverify']==1}
        <div class="panel panel-default">
            <div class="panel-heading">
               联系人
            </div>
            <div class="panel-body">
                   <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">联系人姓名 :</label>
                    <div class="col-sm-9 col-xs-12">
                        <p class="form-control-static">{$user['carrier_realname']} </p>
                    </div>
                </div>
               <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">联系人手机 :</label>
                    <div class="col-sm-9 col-xs-12">
                        <p class="form-control-static">{$user['carrier_mobile']}  </p>
                    </div>
                </div>
            </div>
        </div>
        {else}
          <div class="panel panel-default">
            <div class="panel-heading">
               自提信息
            </div>
            <div class="panel-body">
                   <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">自提人姓名 :</label>
                    <div class="col-sm-9 col-xs-12">
                        <p class="form-control-static">{$user['carrier_realname']} /  {$user['carrier_mobile']}</p>
                    </div>
                </div>
               <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">自提地点 :</label>
                    <div class="col-sm-9 col-xs-12">
                        <p class="form-control-static">{$user['address']} (联系人： {$user['realname']} / {$user['mobile']} ) </p>
                    </div>
                </div>
            </div>
        </div>
        {/if}
      
        {if !empty($refund)}

        <div class="panel panel-default">
            <div class="panel-heading">
                退款申请
            </div>
            <div class="panel-body">
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">退款原因 :</label>
                    <div class="col-sm-9 col-xs-12">
                        <p class="form-control-static">{$refund['reason']}</p>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">退款说明 :</label>
                    <div class="col-sm-9 col-xs-12">
                        <p class="form-control-static">{php echo empty($refund['content'])?'无':$refund['content']}</p>
                    </div>
                </div>
                
                {ifp 'order.op.refund'}
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label"></label>
                    <div class="col-sm-9 col-xs-12">
                        {if $refund['status']==0}
                        <a class="btn btn-danger btn-sm" href="javascript:;" onclick="$('#modal-refund').find(':input[name=id]').val('{$item['id']}')" data-toggle="modal" data-target="#modal-refund">处理退款申请</a>
                        {elseif $refund['status']==-1}
                        <span class='label label-default'>已拒绝</span>
                        {elseif $refund['status']==1}
                        <span class='label label-danger'>已退款</span>
                        {/if}
                    </div>
                </div> 
                {/if}

            </div>
        </div>
        {/if}
        <div class="panel panel-default">
            <div class="panel-heading">
                商品信息</span>
            </div>
            <div class="panel-body table-responsive">
                <table class="table table-hover">
                    <thead class="navbar-inner">
                        <tr>
                            <th style="width:5%;">ID</th>
                            <th style="width:10%;">商品标题</th>
                            <th style="width:15%;">商品规格</th>
                            <th style="width:10%;">商品编号</th>
                            <th style="width:10%;">商品条码</th>
                       
                            <th style="width:20%;">现价/原价/成本价</th>
                            <th style="width:10%;">属性</th>
                            <th style="width:5%;">购买数量</th>
                            <th style="width:10%;color:red;">折扣前/折扣后</th>
                            
                            <th style="width:10%;">操作</th>
                        </tr>
                    </thead>
                    {loop $item['goods'] $goods}
                    <tr>
                        <td>{$goods['id']}</td>
                        <td>
                            {if $category[$goods['pcate']]['name']}
                            <span class="text-error">[{$category[$goods['pcate']]['name']}] </span>{/if}{if $children[$goods['pcate']][$goods['ccate']][1]}
                            <span class="text-info">[{$children[$goods['pcate']][$goods['ccate']][1]}] </span>
                            {/if}
                            {$goods['title']}
                        </td>
                        <td><span class="label label-info">{$goods['optionname']}</span></td>
                        <td>{$goods['goodssn']}</td>
                        <td>{$goods['productsn']}</td>
                        <td>{$goods['marketprice']}元 / {$goods['productprice']}元 / {$goods['costprice']}元</td>
                        <td>{if $goods['status']==1}<span class="label label-success">上架</span>{else}<span class="label label-error">下架</span>{/if}&nbsp;<span class="label label-info">{if $goods['type'] == 1}实体商品{else}虚拟商品{/if}</span></td>
                        <td>{$goods['total']}</td>
                        <td style='color:red;font-weight:bold;'>{$goods['orderprice']}/{$goods['realprice']}</td>
                        <td>  
                            <a href="{php echo $this->createWebUrl('shop/goods', array('id' => $goods['id'], 'op' => 'post'))}" class="btn btn-default btn-sm" data-toggle="tooltip" data-placement="bottom" title="编辑"><i class="fa fa-edit"></i></a>&nbsp;&nbsp;
                        </td>
                    </tr>
                    {/loop}
                    <tr>
                        <td colspan="10">
                            
                           {template 'web/order/ops'}
                            <input type="hidden" name="token" value="{$_W['token']}" />
                        </td>
                    </tr>
                </table>
            </div>
        </div>
{template 'web/order/modals'}


{template 'web/_footer'}
